package com.haiqi.common.utils;

import java.util.UUID;

/**
 * Created by zhaoy on 2016/3/9.
 */
public class UUIDGenerator {
    public static String getUUID() {
        UUID uuid = UUID.randomUUID();
        return uuid.toString();
    }
    //获得指定数量的UUID
    public static String[] getUUID(int number) {
        if (number < 1) {
            return null;
        }
        String[] ss = new String[number];
        for (int i = 0; i < number; i++) {
            ss[i] = getUUID();
        }
        return ss;
    }

    public static void main(String[] args) {
        String uuid = UUIDGenerator.getUUID();
        System.out.println(uuid);
        System.out.println("array:");
        String[] uuids = UUIDGenerator.getUUID(10);
        for (String s : uuids) {
            System.out.println(s);
        }
    }
}
